<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>商品信息列表</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.tabfont01 {	
	font-family: "宋体";
	font-size: 9px;
	color: #555555;
	text-decoration: none;
	text-align: center;
}
.font051 {font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 20px;
}
.font201 {font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.button {
	font-family: "宋体";
	font-size: 14px;
	height: 37px;
}
html { overflow-x: auto; overflow-y: auto; border:0;} 
-->
</style>

<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">

</script>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script language=javascript>
var city = new Array();
 city=[
            ["男装","女装","男鞋","女鞋","配饰","箱包","其它"],
            ["教材","娱乐类","文学类","理工类","其它"],
            ["日常用品","清洁用品","卫浴用品","卧室床品","其它"],
            ["运动器材","饰品","纪念品","玩具","布偶","其它"],
            ["纸质类","工具类","笔类","其它"],
            ["手机数码","配件","二手电子产品","其它"],
            ["其它"]
        ]
  //遍历二维数组，详细分类赋值
 var value=new Array();
 var count = 0;

 for(i = 0;i<city.length;i++)
	 {
		value[i]= new Array();
	 	var child = city[i];

	 	for(j=0;j<child.length;j++)
	 	{
			count++;
	 		value[i][j]= count;
	 	}
	 }
function getCity(){
    var sltProvince=document.forms["form"].elements["mainclass"];
    var sltCity=document.forms["form"].elements["classify"];
    var proID = sltProvince.selectedIndex-1; //获得类别的Id(一位数组id)
    var mainclassCity=city[proID];//获得 类别id对应的一位数组
    sltCity.length=1;
    sltCity.remove(0);
	for(var i=0;i<mainclassCity.length;i++){
		t = value[proID][i];
   	sltCity[i]=new Option(mainclassCity[i],t);            
    }
}
function ConfirmDel()
{
    if(confirm("确定要删除吗？一旦删除将不能恢复！"))
       return true;
     else
        return false;
}
//点击分页时加上查询条件
</script>
</head>

<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td height="30">      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="62" background="../images/nav04.gif"> 
    <form name="form" id="form" method="post" action="queryall.action?page=initial">       
		   <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
		    <tr>
			  <td width="1%"><img src="../images/ico07.gif" width="20" height="18" /></td>
			  <td width="25%">通过商品限制查询：
				<select name="limit" >
					<option value="-1">--请选择限制条件-</option>
					<option value="1">仅限贫困生购买商品</option>
					<option value="2">仅限普通人购买商品</option>
					<option value="0">都可以购买的购买</option>
				</select>
			  </td>
			  <td width="20%">通过关键词查询：
				<input name="keyword" type="text" size="12" />
			  </td>
			  <td width="20%" align="left">通过分类查询：
				<select id="mainclass" name="mainclass" onchange="getCity()">
					<option value="0">请选择商品类别</option>
					<option value="1">服装饰品</option>
					<option value="2">图书杂志</option>
					<option value="3">生活用品 </option>
					<option value="4">文娱用品</option>
					<option value="5">学习用品</option>
					<option value="6">电子产品</option>
					<option value="7">其它用品</option>
					</select>
					<select id="classify" name="classify" >
						<option value="0">--所有分类--</option>
					</select>			
			  </td>
				<td width="20%">
				  <input name="Submit3" type="submit" class="right-button07" value="查询" />
				<a href="#" onclick="sousuo()">
			    <input name="Submit3" type="button" class="right-button07" value="高级查询" /></a>
			  </td>			  
		    </tr>
          </table>
         </form>
		  </td>
        </tr>
    </table></td></tr>
  <tr>
    <td><table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height="40" class="font42">
				<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">
				 <tr class="CTitle" >
                    	<td height="22"  colspan="50" align="center" style="font-size:16px">商品信息列表</td>
                  </tr>
                  <tr bgcolor="#EEEEEE">
				    <td width="2%" align="center" height="30">序号</td>
                    <td width="10%">商品名称</td>
					<td width="6%">库存</td>
                    <td width="6%">金币价</td>
					<td width="6%">爱心币价</td>
					<td width="5%">购买限制</td>
					<td width="30%">商品备注</td>
					<td width="14%">商品关键词</td>
					<td width="24%">操作</td>
                  </tr>
                <s:iterator value="proList" var="c" status="st">
                  <tr bgcolor="#FFFFFF">
				    <td height="20"><s:property value="#st.count"/> </td>
                    <td ><a href="<%=path%>/detail.jsp?id=${c.id}" target="_bank"><s:property value="#c.caption"/></a></td>
					<td><s:property value="#c.inventory" /></td>
                    <td><s:property value="#c.goldPrice"/> </td>
					<td><s:property value="#c.lovePrice"/></td>
                    <td><s:if test="#c.limit==1">仅限贫困生购买</s:if> 
                    	<s:elseif test="#c.limit==2">仅限爱心捐助者购买</s:elseif>
                    	<s:else>无限制</s:else>
                    </td>
                    <td><s:property value="#c.remark"/></td>
                    <td><s:property value="#c.keyword"/> </td>
                    <td><a href="querypro.action?id=${c.id}"><img src="<%=path %>/files/images/edt.gif" width="16" height="16" />重新编辑</a>|
                    	<a href="delpro.action?id=${c.id}" onclick="return ConfirmDel();"><img src="<%=path %>/files/images/del.gif" width="16" height="16" onclick="return ConfirmDel();"/>删除商品</a>|
                    	<a href="<%=basePath %>product.jsp?id=${c.id}" target="_blank"><img src="<%=path %>/files/images/go.gif" width="30" height="16" />前台预览</a>
                    </td>
                  </tr>
                 </s:iterator>
            </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="6"><img src="../images/spacer.gif" width="1" height="1" /></td>
        </tr>
        <tr>
          <td height="33">
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="right-font08">
			<tr align="right">
    	<td colspan="9" id="myhref">
    		共<s:property value="totalRows"/>条记录&nbsp;
    		第<s:property value="currentPage"/>页&nbsp;
    		共<s:property value="pager.getTotalPages()"/>页&nbsp;
    		<a href="<s:url value="queryall.action">
    			<s:param name="currentPage" value="currentPage"/>
    			<s:param name="pagerMethod" value="'first'"/>
    			<s:param name="page" value="'paged'"/>
    		</s:url>">首页</a>
    		<a href="<s:url value="queryall.action">
    			<s:param name="currentPage" value="currentPage"/>
    			<s:param name="pagerMethod" value="'previous'"/>
    			<s:param name="page" value="'paged'"/>
    		</s:url>">上一页</a>
    		<a href="<s:url value="queryall.action">
    			<s:param name="currentPage" value="currentPage"/>
    			<s:param name="pagerMethod" value="'next'"/>
    			<s:param name="page" value="'paged'"/>
    		</s:url>">下一页</a>
    		<a href="<s:url value="queryall.action">
    			<s:param name="currentPage" value="currentPage"/>
    			<s:param name="pagerMethod" value="'last'"/>
    			<s:param name="page" value="'paged'"/>
    		</s:url>">尾页</a>
    	</td>
    	</tr>
          </table>
          </td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
